#Makefile for ISBA soil model source files

include ../../mkfls_profs/Makefile.in
#include ./MakefileCheb.in
#include ./MakefileCheb_precise.in
#include ./MakefileBG.in

formfree_compile = $(f90comp) $(opt_keys) $(check_keys) $(include_keys) $(formfree_key) $(keys) $< -o $@
formfixed_compile = $(f90comp) $(opt_keys) $(check_keys) $(include_keys) $(formfixed_key) $(keys) $< -o $@

objfiles = \
 $(objfile_path)/lake_modules.o \
 $(objfile_path)/phys_func.o \
 $(objfile_path)/massflux_convection_v10.o \
 $(objfile_path)/surf_scheme3.o \
 $(objfile_path)/data_parameters_mod.o \
 $(objfile_path)/flake_parameters_mod.o \
 $(objfile_path)/SfcFlx_mod.o \
 $(objfile_path)/driver_parameters_mod.o \
 \
 $(objfile_path)/convectpar.o \
 $(objfile_path)/heatbalsurf.o \
 $(objfile_path)/init.o \
 $(objfile_path)/inout.o \
 $(objfile_path)/lake.o \
 $(objfile_path)/math_lib.o \
 $(objfile_path)/salinity.o \
 $(objfile_path)/skin.o \
 $(objfile_path)/snowtemp.o \
 $(objfile_path)/snowcalc.o \
 $(objfile_path)/soil.o \
 $(objfile_path)/surf_scheme1.o \
 $(objfile_path)/surf_scheme2.o \
 $(objfile_path)/time.o \
 $(objfile_path)/trib.o \
 $(objfile_path)/init_var.o \
 $(objfile_path)/methane.o \
 $(objfile_path)/carbon_dioxide.o \
 $(objfile_path)/oxygen.o \
 $(objfile_path)/moment.o \
 $(objfile_path)/t_0dim.o \
 $(objfile_path)/turb.o


 all : $(objfiles)

# Compiling module files
 $(objfile_path)/lake_modules.o : lake_modules.f90 
	$(formfree_compile)
 $(objfile_path)/phys_func.o : phys_func.f90 
	$(formfree_compile)
 $(objfile_path)/massfluc_convection_v10.o : massfluc_convection_v10.f90 
	$(formfree_compile)
 $(objfile_path)/surf_scheme3.o : surf_scheme3.f90 
	$(formfree_compile)
 $(objfile_path)/data_parameters_mod.o : data_parameters_mod.F90
	$(formfree_compile)
 $(objfile_path)/flake_parameters_mod.o : flake_parameters_mod.F90
	$(formfree_compile)
 $(objfile_path)/SfcFlx_mod.o : SfcFlx_mod.F90
	$(formfree_compile)
 $(objfile_path)/driver_parameters_mod.o : driver_parameters_mod.f90
	$(formfree_compile)
#	cp lake_driver_parameters.mod $(module_path)

# Compiling other source files
 $(objfile_path)/%.o : %.f90 
	$(formfree_compile)

 $(objfile_path)/%.o : %.f
	$(formfixed_compile)

$(objfile_path)/%.o : %.for
	$(formfixed_compile)


# Cleaning *.o and *.mod files
 clean : 
	rm -f $(objfiles)
